package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.CustomerBean;
import com.project.service.ICustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("customer")
public class CustomerController {
    @Autowired
    private ICustomerService customerService;
    @RequestMapping("cutByItem")
    public IPage<CustomerBean> cutByItem (Integer pageNO, String name, String type ){
        return customerService.cutByItem(pageNO, name, type);
    };

    @RequestMapping("findById")
    public CustomerBean findById(Integer id){
      return   customerService.findById(id);
    };
    @RequestMapping("update")
    public String update(Integer id ,String person,String phone,String type){
        customerService.update(id,person,phone,type);
        return "ok";
    };
    @RequestMapping("add")
    public String add(CustomerBean customerBean){
        customerService.add(customerBean);
        return "ok";
    };

    @RequestMapping("findAll")
    public List<CustomerBean> findAll(){
      return   customerService.findAll();
    };
}
